/*
 * UserDAOImpl.java
 * 
 * Versao: 1.0.0
 *
 * Data: 28/01/2011
 *
 * Copyright (C) 2011
 * wsh-systems.
 * Todos os direitos reservados.
 */
package com.wsh.playeronline.persistence.daoImpl;

import java.util.List;

import javax.persistence.EntityManager;

import com.wsh.playeronline.persistence.dao.UserDAO;
import com.wsh.playeronline.persistence.model.User;

/**
 * Implementacao do UserDAO.
 * 
 * @author washington
 * @version 1.0, 28/01/2011
 */
public class UserDAOImpl implements UserDAO {

	private final DAOImpl<User> dao;
	
	/**
	 * Constructor get to EntityManager.
	 * 
	 * @param em EntityManager
	 */
	public UserDAOImpl(final EntityManager em) {
		this.dao = new DAOImpl<User>(em, User.class);
	}
	
	/**
	 * {@inheritDoc}
	 */
	public void adicionar(User t) {
		this.dao.adiciona(t);		
	}

	/**
	 * {@inheritDoc}
	 */
	public void alterar(User t) {
		this.dao.altera(t);		
	}

	/**
	 * {@inheritDoc}
	 */
	public User buscar(Long codigo) {		
		return this.dao.busca(codigo);
	}

	/**
	 * {@inheritDoc}
	 */
	public void deletar(User t) {
		this.dao.deleta(t);		
	}

	/**
	 * {@inheritDoc}
	 */
	public List<User> listar() {
		return this.dao.lista();
	}

	/**
	 * {@inheritDoc}
	 */
	public void remover(User t) {
		this.dao.remove(t);	
	}

}